<#PSScriptInfo
.VERSION 1.0
.AUTHOR ZHANGQ
.COMPANYNAME HQYSTUDIO.DEV
.COPYRIGHT Copyright 2020 HQYSTUDIO. All rights reserved.
#>

$NGINX_INFO = @{
    'TITLE' = 'Nginx-win64';
    'VERSION' = '1.18.0'
}

$SOURCES = @(
    '.\conf',
    '.\contrib',
    '.\logs',
    '.\temp',
    '.\objs\docs',
    '.\docs\html',
    '.\objs\nginx.exe',
    '.\objs\libs\winsw\*.*'
)

# Copy source to 'Nginx-win64-1.18.0' directory
$dirName = "{0}-{1}" -f $NGINX_INFO.TITLE, $NGINX_INFO.VERSION
$newDir = New-Item -Name $dirName -ItemType Directory

foreach ($source in $SOURCES) {
    Copy-Item -Path $source -Destination $newDir -Force -Recurse
}

# Compress 'Nginx-win64-1.18.0' directory
Compress-Archive -Path $newDir -DestinationPath "$dirName.zip" -CompressionLevel Fastest -Force

# Clear 'Nginx-win64-1.18.0' directory
Remove-Item -Path $newDir -Force -Recurse
